home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / gas_251.zip / bin_251 / binutils / coffgrok.c < prev    next >
C/C++ Source or Header  |  1994-08-06  |  17KB  |  733 lines

  1.  
  2.  
  3. /* coffgrok.c
  4.  
  5.    Copyright (C) 1994 Free Software Foundation, Inc.
  6.  
  7. This file is part of GNU Binutils.
  8.  
  9. This program is free software; you can redistribute it and/or modify
  10. it under the terms of the GNU General Public License as published by
  11. the Free Software Foundation; either version 2 of the License, or
  12. (at your option) any later version.
  13.  
  14. This program is distributed in the hope that it will be useful,
  15. but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17. GNU General Public License for more details.
  18.  
  19. You should have received a copy of the GNU General Public License
  20. along with this program; if not, write to the Free Software
  21. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  22.  
  23. /* Written by Steve Chamberlain (sac@cygnus.com)
  24.  
  25.    This module reads a coff file and builds a really simple type tree
  26.    which can be read by other programs.  The first application is a
  27.    coff->sysroff converter.  It can be tested with coffdump.c.
  28.  
  29. */
  30.  
  31. #include <bfd.h>
  32. #include <stdio.h>
  33.  
  34. #include "coff/internal.h"
  35. #include "../bfd/libcoff.h"
  36. #include "coffgrok.h"
  37. int lofile = 1;
  38. static struct coff_scope *top_scope;
  39. static struct coff_scope *file_scope;
  40. static struct coff_ofile *ofile;
  41.  
  42. struct coff_symbol *last_function_symbol;
  43. struct coff_type *last_function_type;
  44. struct coff_type *last_struct;
  45. struct coff_type *last_enum;
  46. struct coff_sfile *cur_sfile;
  47.  
  48. static struct coff_symbol **tindex;
  49.  
  50.  
  51. static asymbol **syms;
  52. static long symcount;
  53.  
  54. #define N(x) ((x)->_n._n_nptr[1])
  55.  
  56. static struct coff_ptr_struct *rawsyms;
  57. static int rawcount;
  58. static bfd *abfd;
  59. extern char *xcalloc ();
  60. extern char *xmalloc ();
  61. #define PTR_SIZE     4
  62. #define SHORT_SIZE     2
  63. #define INT_SIZE     4
  64. #define LONG_SIZE     4
  65. #define FLOAT_SIZE     4
  66. #define DOUBLE_SIZE     8
  67.  
  68. #define INDEXOF(p)  ((struct coff_ptr_struct *)(p)-(rawsyms))
  69.  
  70. static struct coff_scope *
  71. empty_scope ()
  72. {
  73.   struct coff_scope *l;
  74.   l = (struct coff_scope *) (xcalloc (sizeof (struct coff_scope), 1));
  75.   return l;
  76. }
  77.  
  78. static struct coff_symbol *
  79. empty_symbol ()
  80. {
  81.   return (struct coff_symbol *) (xcalloc (sizeof (struct coff_symbol), 1));
  82. }
  83.  
  84. /*int l;*/
  85. static void
  86. push_scope (link)
  87. {
  88.   struct coff_scope *n = empty_scope ();
  89.   if (link)
  90.     {
  91.       if (top_scope)
  92.     {
  93.       if (top_scope->list_tail)
  94.         {
  95.           top_scope->list_tail->next = n;
  96.         }
  97.       else
  98.         {
  99.           top_scope->list_head = n;
  100.         }
  101.       top_scope->list_tail = n;
  102.     }
  103.     }
  104.   n->parent = top_scope;
  105.  
  106.   top_scope = n;
  107. }
  108.  
  109. static void
  110. pop_scope ()
  111. {
  112.   top_scope = top_scope->parent;
  113. }
  114.  
  115. static void
  116. do_sections_p1 (head)
  117.      struct coff_ofile *head;
  118. {
  119.   asection *section;
  120.   int idx;
  121.   struct coff_section *all = (struct coff_section *) (xcalloc (abfd->section_count + 1,
  122.                          sizeof (struct coff_section)));
  123.   head->nsections = abfd->section_count + 1;
  124.   head->sections = all;
  125.  
  126.   for (idx = 0, section = abfd->sections; section; section = section->next, idx++)
  127.     {
  128.       long relsize;
  129.       int i = section->target_index;
  130.       arelent **relpp;
  131.       long relcount;
  132.  
  133.       relsize = bfd_get_reloc_upper_bound (abfd, section);
  134.       if (relsize < 0)
  135.     bfd_fatal (bfd_get_filename (abfd));
  136.       relpp = (arelent **) xmalloc (relsize);
  137.       relcount = bfd_canonicalize_reloc (abfd, section, relpp, syms);
  138.       if (relcount < 0)
  139.     bfd_fatal (bfd_get_filename (abfd));
  140.  
  141.       head->sections[i].name = (char *) (section->name);
  142.       head->sections[i].code = section->flags & SEC_CODE;
  143.       head->sections[i].data = section->flags & SEC_DATA;
  144.       if (strcmp (section->name, ".bss") == 0)
  145.     head->sections[i].data = 1;
  146.       head->sections[i].address = section->vma;
  147.       head->sections[i].size = section->_raw_size;
  148.       head->sections[i].number = idx;
  149.       head->sections[i].nrelocs = section->reloc_count;
  150.       head->sections[i].relocs =
  151.     (struct coff_reloc *) (xcalloc (section->reloc_count,
  152.                     sizeof (struct coff_reloc)));
  153.       head->sections[i].bfd_section = section;
  154.     }
  155.   head->sections[0].name = "ABSOLUTE";
  156.   head->sections[0].code = 0;
  157.   head->sections[0].data = 0;
  158.   head->sections[0].address = 0;
  159.   head->sections[0].size = 0;
  160.   head->sections[0].number = 0;
  161. }
  162.  
  163. static void
  164. do_sections_p2 (head)
  165.      struct coff_ofile *head;
  166. {
  167.   asection *section;
  168.   for (section = abfd->sections; section; section = section->next)
  169.     {
  170.       int j;
  171.       for (j = 0; j < section->reloc_count; j++)
  172.     {
  173.       int idx;
  174.       int i = section->target_index;
  175.       struct coff_reloc *r = head->sections[i].relocs + j;
  176.       arelent *sr = section->relocation + j;
  177.       r->offset = sr->address;
  178.       r->addend = sr->addend;
  179.       idx = ((coff_symbol_type *) (sr->sym_ptr_ptr[0]))->native - rawsyms;
  180.       r->symbol = tindex[idx];
  181.     }
  182.     }
  183. }
  184.  
  185. static struct coff_where *
  186. do_where (i)
  187.      int i;
  188. {
  189.   struct internal_syment *sym = &rawsyms[i].u.syment;
  190.   struct coff_where *where
  191.   = (struct coff_where *) (malloc (sizeof (struct coff_where)));
  192.   where->offset = sym->n_value;
  193.  
  194.   if (sym->n_scnum == -1)
  195.     sym->n_scnum = 0;
  196.  
  197.   switch (sym->n_sclass)
  198.     {
  199.     case C_FIELD:
  200.       where->where = coff_where_member_of_struct;
  201.       where->offset = sym->n_value / 8;
  202.       where->bitoffset = sym->n_value % 8;
  203.       where->bitsize = rawsyms[i + 1].u.auxent.x_sym.x_misc.x_lnsz.x_size;
  204.       break;
  205.     case C_MOE:
  206.       where->where = coff_where_member_of_enum;
  207.       break;
  208.     case C_MOS:
  209.     case C_MOU:
  210.       where->where = coff_where_member_of_struct;
  211.       break;
  212.     case C_AUTO:
  213.     case C_ARG:
  214.       where->where = coff_where_stack;
  215.       break;
  216.     case C_EXT:
  217.     case C_STAT:
  218.     case C_EXTDEF:
  219.     case C_LABEL:
  220.       where->where = coff_where_memory;
  221.       where->section = &ofile->sections[sym->n_scnum];
  222.       break;
  223.     case C_REG:
  224.     case C_REGPARM:
  225.       where->where = coff_where_register;
  226.       break;
  227.     case C_ENTAG:
  228.       where->where = coff_where_entag;
  229.       break;
  230.     case C_STRTAG:
  231.     case C_UNTAG:
  232.       where->where = coff_where_strtag;
  233.       break;
  234.     case C_TPDEF:
  235.       where->where = coff_where_typedef;
  236.       break;
  237.     default:
  238.       abort ();
  239.       break;
  240.     }
  241.   return where;
  242. }
  243.  
  244. static
  245. struct coff_line *
  246. do_lines (i, name)
  247.      int i;
  248.      char *name;
  249. {
  250.   struct coff_line *res = (struct coff_line *) xcalloc (sizeof (struct coff_line), 1);
  251.   asection *s;
  252.   int l;
  253.   /* Find out if this function has any line numbers in the table */
  254.   for (s = abfd->sections; s; s = s->next)
  255.     {
  256.       for (l = 0; l < s->lineno_count; l++)
  257.     {
  258.       if (s->lineno[l].line_number == 0)
  259.         {
  260.           if (rawsyms + i == ((coff_symbol_type *) (&(s->lineno[l].u.sym[0])))->native)
  261.         {
  262.           /* These lines are for this function - so count them and stick them on */
  263.           int c = 0;
  264.           /* Find the linenumber of the top of the function, since coff linenumbers
  265.              are relative to the start of the function. */
  266.           int start_line = rawsyms[i + 3].u.auxent.x_sym.x_misc.x_lnsz.x_lnno;
  267.  
  268.           l++;
  269.           for (c = 0; s->lineno[l + c + 1].line_number; c++)
  270.             ;
  271.  
  272.           /* Add two extra records, one for the prologue and one for the epilogue */
  273.           c += 1;
  274.           res->nlines = c;
  275.           res->lines = (int *) (xcalloc (sizeof (int), c));
  276.           res->addresses = (int *) (xcalloc (sizeof (int), c));
  277.           res->lines[0] = start_line;
  278.           res->addresses[0] = rawsyms[i].u.syment.n_value - s->vma;
  279.           for (c = 0; s->lineno[l + c + 1].line_number; c++)
  280.             {
  281.               res->lines[c + 1] = s->lineno[l + c].line_number + start_line - 1;
  282.               res->addresses[c + 1] = s->lineno[l + c].u.offset;
  283.             }
  284.           return res;
  285.         }
  286.         }
  287.     }
  288.     }
  289.   return res;
  290. }
  291.  
  292. static
  293. struct coff_type *
  294. do_type (i)
  295.      int i;
  296. {
  297.   struct internal_syment *sym = &rawsyms[i].u.syment;
  298.   union internal_auxent *aux = &rawsyms[i + 1].u.auxent;
  299.   struct coff_type *res = (struct coff_type *) malloc (sizeof (struct coff_type));
  300.   int type = sym->n_type;
  301.   int which_dt = 0;
  302.  
  303.   res->type = coff_basic_type;
  304.   res->u.basic = type & 0xf;
  305.  
  306.   switch (type & 0xf)
  307.     {
  308.     case T_NULL:
  309.     case T_VOID:
  310.       if (sym->n_numaux && sym->n_sclass == C_STAT)
  311.     {
  312.       /* This is probably a section definition */
  313.       res->type = coff_secdef_type;
  314.       res->size = aux->x_scn.x_scnlen;
  315.     }
  316.       else
  317.     {
  318.       if (type == 0)
  319.         {
  320.           /* Don't know what this is, let's make it a simple int */
  321.           res->size = INT_SIZE;
  322.           res->u.basic = T_UINT;
  323.         }
  324.       else
  325.         {
  326.           /* Else it could be a function or pointer to void */
  327.           res->size = 0;
  328.         }
  329.     }
  330.       break;
  331.  
  332.  
  333.       break;
  334.     case T_UCHAR:
  335.     case T_CHAR:
  336.       res->size = 1;
  337.       break;
  338.     case T_USHORT:
  339.     case T_SHORT:
  340.       res->size = SHORT_SIZE;
  341.       break;
  342.     case T_UINT:
  343.     case T_INT:
  344.       res->size = INT_SIZE;
  345.       break;
  346.     case T_ULONG:
  347.     case T_LONG:
  348.       res->size = LONG_SIZE;
  349.       break;
  350.     case T_FLOAT:
  351.       res->size = FLOAT_SIZE;
  352.       break;
  353.     case T_DOUBLE:
  354.       res->size = DOUBLE_SIZE;
  355.       break;
  356.     case T_STRUCT:
  357.     case T_UNION:
  358.       if (sym->n_numaux)
  359.     {
  360.       if (aux->x_sym.x_tagndx.p)
  361.         {
  362.           /* Refering to a struct defined elsewhere */
  363.           res->type = coff_structref_type;
  364.           res->u.astructref.ref = tindex[INDEXOF (aux->x_sym.x_tagndx.p)];
  365.           res->size = res->u.astructref.ref ?
  366.         res->u.astructref.ref->type->size : 0;
  367.         }
  368.       else
  369.         {
  370.           /* A definition of a struct */
  371.           last_struct = res;
  372.           res->type = coff_structdef_type;
  373.           res->u.astructdef.elements = empty_scope ();
  374.           res->u.astructdef.idx = 0;
  375.           res->u.astructdef.isstruct = (type & 0xf) == T_STRUCT;
  376.           res->size = aux->x_sym.x_misc.x_lnsz.x_size;
  377.         }
  378.     }
  379.       else
  380.     {
  381.       /* No auxents - it's anonynmous */
  382.       res->type = coff_structref_type;
  383.       res->u.astructref.ref = 0;
  384.       res->size = 0;
  385.     }
  386.       break;
  387.     case T_ENUM:
  388.       if (aux->x_sym.x_tagndx.p)
  389.     {
  390.       /* Refering to a enum defined elsewhere */
  391.       res->type = coff_enumref_type;
  392.       res->u.aenumref.ref = tindex[INDEXOF (aux->x_sym.x_tagndx.p)];
  393.       res->size = res->u.aenumref.ref->type->size;
  394.     }
  395.       else
  396.     {
  397.       /* A definition of an enum */
  398.       last_enum = res;
  399.       res->type = coff_enumdef_type;
  400.       res->u.aenumdef.elements = empty_scope ();
  401.       res->size = aux->x_sym.x_misc.x_lnsz.x_size;
  402.     }
  403.       break;
  404.     case T_MOE:
  405.       break;
  406.     }
  407.  
  408.   for (which_dt = 5; which_dt >= 0; which_dt--)
  409.     {
  410.       switch ((type >> ((which_dt * 2) + 4)) & 0x3)
  411.     {
  412.     case 0:
  413.       break;
  414.     case DT_ARY:
  415.       {
  416.  
  417.         /* Look in the auxent for the dimensions and build lots of dims */
  418.         int els = aux->x_sym.x_fcnary.x_ary.x_dimen[which_dt];
  419.         if (els)
  420.           {
  421.         struct coff_type *ptr = (struct coff_type *) malloc (sizeof (struct coff_type));
  422.         ptr->type = coff_array_type;
  423.         ptr->size = els * res->size;
  424.         ptr->u.array.dim = els;
  425.         ptr->u.array.array_of = res;
  426.         res = ptr;
  427.           }
  428.       }
  429.  
  430.       break;
  431.     case DT_PTR:
  432.       {
  433.         struct coff_type *ptr = (struct coff_type *) malloc (sizeof (struct coff_type));
  434.         ptr->size = PTR_SIZE;
  435.         ptr->type = coff_pointer_type;
  436.         ptr->u.pointer.points_to = res;
  437.         res = ptr;
  438.         break;
  439.       }
  440.     case DT_FCN:
  441.       {
  442.         struct coff_type *ptr = (struct coff_type *) malloc (sizeof (struct coff_type));
  443.         ptr->size = 0;
  444.         ptr->type = coff_function_type;
  445.         ptr->u.function.function_returns = res;
  446.         ptr->u.function.parameters = empty_scope ();
  447.         ptr->u.function.lines = do_lines (i, sym->_n._n_nptr[1]);
  448.         ptr->u.function.code = 0;
  449.         last_function_type = ptr;
  450.         res = ptr;
  451.         break;
  452.       }
  453.     }
  454.     }
  455.   return res;
  456. }
  457.  
  458. static struct coff_visible *
  459. do_visible (i)
  460.      int i;
  461. {
  462.   struct internal_syment *sym = &rawsyms[i].u.syment;
  463.   struct coff_visible *visible = (struct coff_visible *) (malloc (sizeof (struct coff_visible)));
  464.   enum coff_vis_type t;
  465.   switch (sym->n_sclass)
  466.     {
  467.     case C_MOS:
  468.     case C_MOU:
  469.     case C_FIELD:
  470.       t = coff_vis_member_of_struct;
  471.       break;
  472.     case C_MOE:
  473.       t = coff_vis_member_of_enum;
  474.       break;
  475.  
  476.     case C_REGPARM:
  477.       t = coff_vis_regparam;
  478.       break;
  479.  
  480.     case C_REG:
  481.       t = coff_vis_register;
  482.       break;
  483.     case C_STRTAG:
  484.     case C_UNTAG:
  485.     case C_ENTAG:
  486.     case C_TPDEF:
  487.       t = coff_vis_tag;
  488.       break;
  489.     case C_AUTOARG:
  490.     case C_ARG:
  491.       t = coff_vis_autoparam;
  492.       break;
  493.     case C_AUTO:
  494.  
  495.  
  496.       t = coff_vis_auto;
  497.       break;
  498.     case C_LABEL:
  499.     case C_STAT:
  500.       t = coff_vis_int_def;
  501.       break;
  502.     case C_EXT:
  503.       if (sym->n_scnum == N_UNDEF)
  504.     {
  505.       if (sym->n_value)
  506.         t = coff_vis_common;
  507.       else
  508.         t = coff_vis_ext_ref;
  509.     }
  510.       else
  511.     t = coff_vis_ext_def;
  512.       break;
  513.     default:
  514.       abort ();
  515.       break;
  516.  
  517.     }
  518.   visible->type = t;
  519.   return visible;
  520. }
  521.  
  522. static int
  523. do_define (i, b)
  524.      int i;
  525.      struct coff_scope *b;
  526. {
  527.   static int symbol_index;
  528.   struct internal_syment *sym = &rawsyms[i].u.syment;
  529.  
  530.   /* Define a symbol and attach to block b */
  531.   struct coff_symbol *s = empty_symbol ();
  532.  
  533.   s->number = ++symbol_index;
  534.   s->name = sym->_n._n_nptr[1];
  535.   s->sfile = cur_sfile;
  536.   /* Glue onto the ofile list */
  537.   if (lofile >= 0)
  538.     {
  539.       if (ofile->symbol_list_tail)
  540.     ofile->symbol_list_tail->next_in_ofile_list = s;
  541.       else
  542.     ofile->symbol_list_head = s;
  543.       ofile->symbol_list_tail = s;
  544.       /* And the block list */
  545.     }
  546.   if (b->vars_tail)
  547.     b->vars_tail->next = s;
  548.   else
  549.     b->vars_head = s;
  550.  
  551.   b->vars_tail = s;
  552.   b->nvars++;
  553.   s->type = do_type (i);
  554.   s->where = do_where (i);
  555.   s->visible = do_visible (i);
  556.  
  557.   tindex[i] = s;
  558.  
  559.   /* We remember the lowest address in each section for each source file */
  560.  
  561.   if (s->where->where == coff_where_memory
  562.       && s->type->type == coff_secdef_type)
  563.     {
  564.       struct coff_isection *is = cur_sfile->section + s->where->section->number;
  565.  
  566.       if (!is->init)
  567.     {
  568.       is->low = s->where->offset;
  569.       is->high = s->where->offset + s->type->size;
  570.       is->init = 1;
  571.       is->parent = s->where->section;
  572.     }
  573.  
  574.     }
  575.  
  576.   if (s->type->type == coff_function_type)
  577.     last_function_symbol = s;
  578.  
  579.   return i + sym->n_numaux + 1;
  580. }
  581.  
  582.  
  583. static
  584. struct coff_ofile *
  585. doit ()
  586. {
  587.   int i;
  588.   int infile = 0;
  589.   struct coff_ofile *head =
  590.   (struct coff_ofile *) xmalloc (sizeof (struct coff_ofile));
  591.   ofile = head;
  592.   head->source_head = 0;
  593.   head->source_tail = 0;
  594.   head->nsources = 0;
  595.   head->symbol_list_tail = 0;
  596.   head->symbol_list_head = 0;
  597.   do_sections_p1 (head);
  598.   push_scope (1);
  599.  
  600.   for (i = 0; i < rawcount;)
  601.     {
  602.       struct internal_syment *sym = &rawsyms[i].u.syment;
  603.       switch (sym->n_sclass)
  604.     {
  605.     case C_FILE:
  606.       {
  607.         /* new source file announced */
  608.         struct coff_sfile *n = (struct coff_sfile *) malloc (sizeof (struct coff_sfile));
  609.         n->section = (struct coff_isection *) xcalloc (sizeof (struct coff_isection), abfd->section_count + 1);
  610.         cur_sfile = n;
  611.         n->name = sym->_n._n_nptr[1];
  612.         n->next = 0;
  613.  
  614.         if (infile)
  615.           {
  616.         pop_scope ();
  617.           }
  618.         infile = 1;
  619.         push_scope (1);
  620.         file_scope = n->scope = top_scope;
  621.  
  622.         if (head->source_tail)
  623.           head->source_tail->next = n;
  624.         else
  625.           head->source_head = n;
  626.         head->source_tail = n;
  627.         head->nsources++;
  628.         i += sym->n_numaux + 1;
  629.       }
  630.       break;
  631.     case C_FCN:
  632.       {
  633.         char *name = sym->_n._n_nptr[1];
  634.         if (name[1] == 'b')
  635.           {
  636.         /* Function start */
  637.         push_scope (0);
  638.         last_function_type->u.function.code = top_scope;
  639.         top_scope->sec = ofile->sections + sym->n_scnum;
  640.         top_scope->offset = sym->n_value;
  641.           }
  642.         else
  643.           {
  644.         top_scope->size = sym->n_value - top_scope->offset + 1;
  645.         pop_scope ();
  646.  
  647.           }
  648.         i += sym->n_numaux + 1;
  649.       }
  650.       break;
  651.  
  652.     case C_BLOCK:
  653.       {
  654.         char *name = sym->_n._n_nptr[1];
  655.         if (name[1] == 'b')
  656.           {
  657.         /* Block start */
  658.         push_scope (1);
  659.         top_scope->sec = ofile->sections + sym->n_scnum;
  660.         top_scope->offset = sym->n_value;
  661.  
  662.           }
  663.         else
  664.           {
  665.         top_scope->size = sym->n_value - top_scope->offset + 1;
  666.         pop_scope ();
  667.           }
  668.         i += sym->n_numaux + 1;
  669.       }
  670.       break;
  671.     case C_REGPARM:
  672.     case C_ARG:
  673.       i = do_define (i, last_function_symbol->type->u.function.parameters);
  674.       break;
  675.     case C_MOS:
  676.     case C_MOU:
  677.     case C_FIELD:
  678.       i = do_define (i, last_struct->u.astructdef.elements);
  679.       break;
  680.     case C_MOE:
  681.       i = do_define (i, last_enum->u.aenumdef.elements);
  682.       break;
  683.     case C_STRTAG:
  684.     case C_ENTAG:
  685.     case C_UNTAG:
  686.       /* Various definition */
  687.       i = do_define (i, top_scope);
  688.       break;
  689.     case C_EXT:
  690.     case C_LABEL:
  691.       i = do_define (i, file_scope);
  692.       break;
  693.     case C_STAT:
  694.     case C_TPDEF:
  695.     case C_AUTO:
  696.     case C_REG:
  697.       i = do_define (i, top_scope);
  698.       break;
  699.     default:
  700.       abort ();
  701.     case C_EOS:
  702.       i += sym->n_numaux + 1;
  703.       break;
  704.     }
  705.     }
  706.   do_sections_p2 (head);
  707.   return head;
  708. }
  709.  
  710. struct coff_ofile *
  711. coff_grok (inabfd)
  712.      bfd *inabfd;
  713. {
  714.   long storage;
  715.   struct coff_ofile *p;
  716.   abfd = inabfd;
  717.   storage = bfd_get_symtab_upper_bound (abfd);
  718.  
  719.   if (storage < 0)
  720.     bfd_fatal (abfd->filename);
  721.  
  722.   syms = (asymbol **) xmalloc (storage);
  723.   symcount = bfd_canonicalize_symtab (abfd, syms);
  724.   if (symcount < 0)
  725.     bfd_fatal (abfd->filename);
  726.   rawsyms = obj_raw_syments (abfd);
  727.   rawcount = obj_raw_syment_count (abfd);;
  728.   tindex = (struct coff_symbol **) (xcalloc (sizeof (struct coff_symbol *), rawcount));
  729.  
  730.   p = doit ();
  731.   return p;
  732. }
  733.